#include "PlatformProperty.h"
#include <android-base/properties.h>

VIRTUAL_PROPERTY(CCToAudioSystemProperty) {
    builder.toTask()
        .subscribeSignals([]() {
            std::string isBooster = "false";
            if (SIGNAL.carConfigIs(SignalRX::carconfig466, sdb::CarConfig466::_84)) {
                isBooster = "false";
            } else if(SIGNAL.carConfigIs(SignalRX::carconfig466, sdb::CarConfig466::_04)){
                isBooster = "true";
            } else {
                isBooster = "true";
                VHALOG.d("CCToAudioSystemProperty carConfig466:%d is error, so set isBooster to default true", SIGNAL.getcarconfig466());
            }
            VHALOG.d("CCToAudioSystemProperty carConfig466 is:%d and setproperty isBooster : %s", SIGNAL.getcarconfig466(), isBooster.c_str());
            android::base::SetProperty("vendor.audio_hal.isBooster", isBooster);
        }, SignalRX::carconfig466);

        std::string isBooster = "false";
        if (SIGNAL.carConfigIs(SignalRX::carconfig466, sdb::CarConfig466::_84)) {
            isBooster = "false";
        } else if(SIGNAL.carConfigIs(SignalRX::carconfig466, sdb::CarConfig466::_04)){
            isBooster = "true";
        } else {
            isBooster = "true";
            VHALOG.d("CCToAudioSystemProperty carConfig466:%d is error, so set isBooster to default true", SIGNAL.getcarconfig466());
        }
        VHALOG.d("CCToAudioSystemProperty carConfig466 is:%d and setproperty isBooster : %d", SIGNAL.getcarconfig466(), isBooster.c_str());
        android::base::SetProperty("vendor.audio_hal.isBooster", isBooster);
}
